package com.hrsystem.mapper;

import com.hrsystem.entity.FileInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * Created by IntelliJ IDEA.
 * User: zxm52
 * Date: 2021/6/23
 * Time: 10:14
 */
public interface FileMapper {

    /**
     * 根据文件MD5查询文件上传记录
     *
     * @param md5
     * @return
     */
    @Select("select * from pic where md5 = #{md5}")
    FileInfo getFileInfoByMD5(String md5);

    /**
     * 保存文件上传记录
     *
     * @param info
     * @return
     */
    @Insert("insert into pic (name, url, path, size, type, md5) values " +
            "(#{info.name}, #{info.url}, #{info.path}, #{info.size}, #{info.type}, #{info.md5})")
    boolean createFileInfo(@Param("info") FileInfo info);
}
